/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50711
 Source Host           : localhost
 Source Database       : firemgt

 Target Server Type    : MySQL
 Target Server Version : 50711
 File Encoding         : utf-8

 Date: 05/16/2016 09:54:26 AM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `comment`
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
  `comment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `score` double(11,2) DEFAULT NULL COMMENT '当前评分，平均值',
  `time` int(10) DEFAULT NULL COMMENT '评分时间段',
  `user_id` int(11) DEFAULT NULL COMMENT '用户id',
  `reg_time` int(10) DEFAULT NULL COMMENT '评分新建时间',
  `source_user_id` int(11) DEFAULT NULL COMMENT '新增评分的用户id。',
  `ext` varchar(1024) DEFAULT NULL COMMENT '扩展字段',
  `del` tinyint(1) DEFAULT NULL COMMENT '删除标志，1正常，2删除',
  PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `comment`
-- ----------------------------
BEGIN;
INSERT INTO `comment` VALUES ('1', '1.67', '1463109214', '10003', '1463109214', '10001', '{\"question_list\":[{\"1\":\"1\"},{\"2\":\"2\"},{\"3\":\"2\"}],\"question_num\":3}', '1'), ('2', '3.67', '1463109230', '10003', '1463109230', '10001', '{\"question_list\":[{\"1\":\"3\"},{\"2\":\"4\"},{\"3\":\"4\"}],\"question_num\":3}', '1'), ('3', '5.67', '1463109267', '10003', '0', '10001', '{\"question_list\":[{\"1\":\"5\"},{\"2\":\"6\"},{\"3\":\"6\"}],\"question_num\":3}', '1');
COMMIT;

-- ----------------------------
--  Table structure for `comment_question`
-- ----------------------------
DROP TABLE IF EXISTS `comment_question`;
CREATE TABLE `comment_question` (
  `comment_question_id` int(4) NOT NULL AUTO_INCREMENT,
  `question` varchar(128) NOT NULL COMMENT '问题名称',
  `level_0` int(3) DEFAULT NULL COMMENT '问题级别分数，差',
  `level_1` int(2) DEFAULT NULL COMMENT '问题级别分数，一般',
  `level_2` int(2) DEFAULT NULL COMMENT '问题级别分数，好',
  `level_3` int(2) DEFAULT NULL COMMENT '问题级别分数，非常好',
  PRIMARY KEY (`comment_question_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `comment_question`
-- ----------------------------
BEGIN;
INSERT INTO `comment_question` VALUES ('1', '服务态度', '1', '3', '5', '10'), ('2', '工作是否认真', '2', '4', '6', '8'), ('3', '维护质量', '2', '4', '6', '8');
COMMIT;

-- ----------------------------
--  Table structure for `company`
-- ----------------------------
DROP TABLE IF EXISTS `company`;
CREATE TABLE `company` (
  `company_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '企业id',
  `name` varchar(64) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL COMMENT '企业法人，关联user表',
  `address` varchar(128) DEFAULT NULL COMMENT '企业地址',
  `phone` varchar(24) DEFAULT NULL COMMENT '联系电话',
  `fax` varchar(45) DEFAULT NULL COMMENT '传真',
  `bank` varchar(45) DEFAULT NULL COMMENT '开户银行',
  `bank_user` varchar(45) DEFAULT NULL COMMENT '开户名称',
  `bank_no` varchar(45) DEFAULT NULL COMMENT '开户账号',
  `del` tinyint(1) DEFAULT '1' COMMENT '删除标志，1正常，2删除',
  PRIMARY KEY (`company_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `company`
-- ----------------------------
BEGIN;
INSERT INTO `company` VALUES ('1', 'Cheetah Mobile', '10003', '北京市朝阳区姚家园南路1号', '18911306095', '123-456', '招商银行1', '马群1', '123456789012345', '1'), ('2', 'Cheetah Mobile', '10003', '11111', '11111', '11111', '1111', '1111', '11111', '1');
COMMIT;

-- ----------------------------
--  Table structure for `contract`
-- ----------------------------
DROP TABLE IF EXISTS `contract`;
CREATE TABLE `contract` (
  `contract_id` varchar(32) NOT NULL COMMENT '合同编号，字符串。',
  `company_name` varchar(64) DEFAULT NULL COMMENT '企业名称',
  `amount` double DEFAULT NULL COMMENT '合同金额',
  `make_time` int(11) DEFAULT NULL COMMENT '签订日期',
  `end_time` int(11) DEFAULT NULL COMMENT '合同截至日期',
  `content` text COMMENT '合同内容',
  `extern` text COMMENT '其他附加信息',
  `reg_time` int(11) DEFAULT NULL COMMENT '合同录入时间',
  `del` tinyint(1) DEFAULT NULL COMMENT '删除状态，1正常，2删除。',
  PRIMARY KEY (`contract_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `contract`
-- ----------------------------
BEGIN;
INSERT INTO `contract` VALUES ('cm-20160418', 'Cheetah Mobile', '1000.01', '1459440000', '1461945600', '合同新建测试', '11111', '1462940196', '1');
COMMIT;

-- ----------------------------
--  Table structure for `equ_repair_records`
-- ----------------------------
DROP TABLE IF EXISTS `equ_repair_records`;
CREATE TABLE `equ_repair_records` (
  `equ_repair_records_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `repair_record_no` varchar(32) DEFAULT NULL COMMENT '维保纪录编号',
  `user_id` int(11) NOT NULL COMMENT '维保员工id，关联user表',
  `contract_id` varchar(32) NOT NULL COMMENT '合同编号，关联表contract',
  `repair_time` int(10) DEFAULT NULL COMMENT '维修时间',
  `equipment_id` int(11) DEFAULT NULL COMMENT '维保设备编号',
  `company_id` int(11) DEFAULT NULL COMMENT '维保企业id',
  `comment_id` int(11) DEFAULT NULL COMMENT '企业评价，关联表comment',
  `del` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`equ_repair_records_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `equ_repair_records`
-- ----------------------------
BEGIN;
INSERT INTO `equ_repair_records` VALUES ('1', 'repair_0000', '10003', 'cm-20160418', '1463042011', '2', '1', '0', '1'), ('2', 'repair_0001', '10003', 'cm-20160418', '1462809600', '1', '1', '2', '1'), ('3', 'repair_0002', '10003', 'cm-20160418', '1463049389', '2', '2', '3', '1');
COMMIT;

-- ----------------------------
--  Table structure for `equipment`
-- ----------------------------
DROP TABLE IF EXISTS `equipment`;
CREATE TABLE `equipment` (
  `equipment_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `number` varchar(45) DEFAULT NULL COMMENT '设备编号',
  `name` varchar(128) DEFAULT NULL COMMENT '设备名称',
  `source` varchar(45) DEFAULT NULL COMMENT '生产厂家',
  `info` text COMMENT '设备信息，如参数等设备信息',
  `user_id` varchar(45) DEFAULT NULL COMMENT '操作人，即添加设备的人',
  `reg_time` int(11) DEFAULT NULL COMMENT '添加时间',
  `del` tinyint(2) DEFAULT NULL COMMENT '设备信息状态，1正常，2删除',
  PRIMARY KEY (`equipment_id`),
  UNIQUE KEY `equipment_id_UNIQUE` (`equipment_id`),
  UNIQUE KEY `equipment_no_UNIQUE` (`number`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `equipment`
-- ----------------------------
BEGIN;
INSERT INTO `equipment` VALUES ('1', 'cm-1000', '设备1', '生产厂家1', '参数，型号', '10001', '1462958008', '1'), ('2', 'cm-1001', '设备2', '生产厂家2', '参数2，型号2121', '10001', '1463037727', '1');
COMMIT;

-- ----------------------------
--  Table structure for `fault_records`
-- ----------------------------
DROP TABLE IF EXISTS `fault_records`;
CREATE TABLE `fault_records` (
  `fault_records_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `equipment_id` int(11) unsigned NOT NULL COMMENT '设备编号',
  `records_no` char(15) DEFAULT NULL COMMENT '记录编号',
  `fault_time` int(10) DEFAULT NULL COMMENT '故障时间',
  `fault_reason` varchar(1024) DEFAULT NULL COMMENT '故障原因',
  `deal_method` varchar(1024) DEFAULT NULL COMMENT '处理办法',
  `status` varchar(20) DEFAULT NULL COMMENT '维护后设备状态',
  `reg_time` int(11) DEFAULT NULL,
  `del` tinyint(1) DEFAULT NULL COMMENT '删除状态，1正常2删除',
  `years_month` varchar(7) DEFAULT NULL COMMENT '年份和月份，用于数据统计',
  `m` int(3) DEFAULT '1' COMMENT '月份，用于数据统计',
  PRIMARY KEY (`fault_records_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `fault_records`
-- ----------------------------
BEGIN;
INSERT INTO `fault_records` VALUES ('1', '1', 'records_10000', '1462896000', '原因1', '处理办法1', '回复生产', '1462982400', '1', '201605', '5'), ('2', '1', 'records_10001', '1462809600', '原因1-1', '处理办法1-1', '回复生产-1', '1462982400', '1', '201605', '5'), ('3', '2', 'records_10002', '1462896000', '坏了', '修理', '好了', '1462982400', '1', '201605', '5'), ('4', '1', 'records_10003', '1457452800', '不能用了', '修理好了', '啦啦啦', '1462982400', '1', '201603', '3'), ('5', '1', 'records_10004', '1459872000', 'aaaa', 'aaaaa', 'aaaaa', '1463036939', '1', '201604', '4');
COMMIT;

-- ----------------------------
--  Table structure for `position`
-- ----------------------------
DROP TABLE IF EXISTS `position`;
CREATE TABLE `position` (
  `position_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '职位id，主键递增',
  `name` varchar(45) DEFAULT NULL COMMENT '职位名称',
  `description` varchar(45) DEFAULT NULL COMMENT '职位描述',
  `del` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`position_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
--  Table structure for `role`
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '角色id，主键递增。',
  `name` varchar(45) DEFAULT NULL COMMENT '角色名称',
  `description` varchar(45) DEFAULT NULL COMMENT '角色描述',
  `purview_id` varchar(45) DEFAULT NULL COMMENT '权限id，关联表purview',
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `role`
-- ----------------------------
BEGIN;
INSERT INTO `role` VALUES ('1', '维保人员', '维保人员', '3'), ('2', '主管', '主管', '2'), ('3', '系统管理员', '系统管理员', '1'), ('4', '企业法人', '企业法人', '4');
COMMIT;

-- ----------------------------
--  Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '员工编号',
  `name` varchar(45) NOT NULL COMMENT '登录名',
  `nickname` varchar(45) DEFAULT NULL COMMENT '员工姓名',
  `gender` tinyint(1) DEFAULT '1' COMMENT '性别，1男2女，默认为1',
  `borth` int(10) DEFAULT NULL COMMENT '出生年月,时间戳保存',
  `work_time` int(10) DEFAULT NULL COMMENT '入职时间，时间戳',
  `position_id` int(11) DEFAULT NULL COMMENT ' 职位，关联position表',
  `role_id` int(11) DEFAULT NULL COMMENT '角色id，关联表role',
  `password` varchar(45) DEFAULT NULL COMMENT '登录密码',
  `status` tinyint(2) DEFAULT NULL COMMENT '员工状态，1，在职，2，离职。',
  `reg_time` int(10) DEFAULT NULL COMMENT '创建时间。',
  `del` tinyint(1) DEFAULT NULL COMMENT ' 是否已被删除，1，正常，0删除。',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10004 DEFAULT CHARSET=utf8 COMMENT='员工表';

-- ----------------------------
--  Records of `user`
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES ('10000', 'mabo', '马博', '1', '694195200', '1460908800', '1', '3', 'aebf0f59f4b2429ac043ef7a918fb1e5', '1', '1460972352', '1'), ('10001', 'maqun', '马群', '1', '720547200', '1460908800', '1', '2', '9cc2b6e7420a77ffe07042f0b22283b1', '1', '1460974613', '1'), ('10002', 'company', '企业法人', '1', '694195200', '1460908800', '1', '4', '81a6ea0dd511813ae70b2b78b80018d0', '1', '1460979914', '1'), ('10003', 'maqun1', 'maqun-weibao', '1', '694195200', '1460908800', '1', '1', '9e45ce35a520f7c9b1027bb8a57ddeed', '1', '0', '1');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
